var api = require('../../utils/api.js');
var app = getApp();
var WxParse = require('../../wxParse/wxParse.js');

Page({

    /**
     * 页面的初始数据
     */
    data: {
        vlink:'',
        id:'',
        indexs:0
    },

    kaoshi(){
        var id=this.data.id;
        
        wx.navigateTo({
          url: '/pages/video/test?id='+id
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var id=options.id;
        this.setData({
            id:id
        })
        this.getmyvideo(id);
    },

       // 我能学习的内容
    getmyvideo(id){
        var that=this;
        api.post({
            url: 'video/getvideobyid',
            data: {id:id},
            success: data => {
                console.log(data);
                var list=data.data.videos;
                WxParse.wxParse('articleContent', 'html', data.data.content, this, 30);
                that.setData({
                    lists:data.data.videos,
                    vlink:list[0],
                    contents:data.data.content
                })
                wx.setNavigationBarTitle({title: data.data.name})
               
            }
        });

    },


    savelink(ret){
        console.log(ret);
        var link=ret.currentTarget.dataset.link;
        var indexs=ret.currentTarget.dataset.indexs;
        var id=this.data.id;
        this.setData({
            vlink:link,
            indexs:indexs
        })
  

    }
})